//
//  AccountBookNameCell.m
//  ProjectOneDemo
//
//  Created by dllo on 16/5/18.
//  Copyright © 2016年 wjg. All rights reserved.
//

#import "AccountBookNameCell.h"
#import "Common.h"

#define WIDTH [UIScreen mainScreen].bounds.size.width


@interface AccountBookNameCell()<UITextFieldDelegate>

@end
@implementation AccountBookNameCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.nameLabel];
    self.nameLabel.text = @"账本名";
    
    
    self.nameTextField = [[UITextField alloc]init];
    [self.contentView addSubview:self.nameTextField];
    self.nameTextField.delegate = self;
    self.nameTextField.placeholder = @"个人账本";
    _nameTextField.textAlignment = NSTextAlignmentRight;
//    self.nameTextField.backgroundColor = [UIColor blackColor];

    
    self.lineView = [[UIView alloc] init];
    [self.contentView addSubview:_lineView];
    self.lineView.backgroundColor = LIGHT_GRAY;
    
    
    
    
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.nameLabel.frame = CGRectMake(10, 5, 150, 40);
    
    self.nameTextField.frame = CGRectMake(WIDTH - 90 / 414.0 * WIDTH, (WIDTH * (7 / 414.0)), 80 / 414.0 * WIDTH, 35 / 414.0 * WIDTH);
    
    self.lineView.frame = CGRectMake(0, self.contentView.frame.size.height - 1, WIDTH, 1);
}



- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
